package com.LeeCode;

/**
 * 二叉树的最大深度
 */
public class Code104 {
    public static void main(String[] args) {
        Integer[] arr = {3, 9, 20, null, null, 15, 7};
        TreeNode root = Utils.buildTree(arr);
        System.out.println(new Code104().maxDepth(root));
    }

    public int maxDepth(TreeNode root) {
        if (root == null)
            return 0;
        return Math.max(maxDepth(root.left), maxDepth(root.right)) + 1;
    }
}
